// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   pk1.YCCtbl.java

package MaintMenu.VenPricingUpdMasterFiles;

import javax.swing.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class GENERA{

    public GENERA() {
        int cc=0;
        int counter=1;
        int x=0;
        int y=0;
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String dataSourceName = "dbLI";
            String dbURL = (new StringBuilder()).append("jdbc:odbc:").append(dataSourceName).toString();
            Connection conli = DriverManager.getConnection(dbURL, "", "");
            //Statement stli = conli.createStatement();



//            String dataSourceName6 = "dbBL";
//            String dbURL6 = (new StringBuilder()).append("jdbc:odbc:").append(dataSourceName6).toString();
//            Connection conbk = DriverManager.getConnection(dbURL6, "", "");
//            Statement stbk1 = conbk.createStatement();
//            Statement stbk2 = conbk.createStatement();
//            Statement stbk3 = conbk.createStatement();

            //Here is where you enter SQL Statements

            //clean up fields

            String st[] = new String[6];

//            st[0] = ("Select * from mirrorm11");
//            st[0] = ("UPDATE tblmrn SET gn_p=null, [GN#]=null, gn_k=null");
//            st[1] = ("UPDATE tblltn SET gn_p=null, [gn#]=null, gn_k=null");


            //clean up MASTER Category file

            st[0] = ("UPDATE mirrorm1 SET gn_no=null");
            st[1] = ("UPDATE LT_mast1 SET tyc_no=null");
            st[2] = ("UPDATE coolngm SET gn_no=null");

            st[3]= ("UPDATE mirrorm1 AS a INNER JOIN _costgenera1 AS b ON a.partlink = b.[PartsLink #] " +
                    "SET " +
                    "a.[part_no]=b.[OEM #], " +
                    "a.[gn_prc] = b.[Net $], " +
                    "a.[gn_no] =b.Item, " +
                    "a.[gn_pkg] = b.StdPk;");

            st[4]= ("UPDATE LT_MAST1 AS a INNER JOIN _costgenera1 AS b ON a.partlink = b.[PartsLink #] " +
                    "SET " +
                    "a.[oem_no]=b.[OEM #], " +
                    "a.[tyc_prc] = b.[Net $], " +
                    "a.[tyc_no] =b.Item, " +
                    "a.[tyc_pkg] = b.StdPk;");

            st[5]= ("UPDATE coolngm AS a INNER JOIN _costgenera1 AS b ON a.partlink = b.[PartsLink #] " +
                    "SET " +
                    "a.[part_no]=b.[OEM #], " +
                    "a.[gn_prc] = b.[Net $], " +
                    "a.[gn_no] =b.Item, " +
                    "a.[gn_pkg] = b.StdPk;");

            for (x=0; x<st.length;x++){
                Statement stli = conli.createStatement();

                try {

//                    System.out.println("Script :"+x);
                    int rowsupdated = stli.executeUpdate(st[x]);
                    System.out.print("TRU : "+rowsupdated+"\t");
                    //JOptionPane.showOptionDialog(null, "Statement : " + st[x] + "\n\nTotal record Updated : " + rowsupdated, "Update Complete", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new Object[]{}, null);
                    cc++;
                    if (cc==4){
                        System.out.println("");
                        cc=0;
                    }


                }catch(SQLException er) {
                    er.printStackTrace();
                }stli.close();
            }




//            stbk1.close();
//            stbk2.close();
//            stbk3.close();
            conli.close();
//            conbk.close();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}
